
/*
 * Copyright 2002-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2020原作者。
 *
 *根据Apache许可证2.0版（“许可证”）许可；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，否则软件
 *根据许可证分发是在“按原样”的基础上分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证
 *许可证下的限制。
 */

package org.springframework.context;

/**
 * Callback interface for initializing a Spring {@link ConfigurableApplicationContext}
 * prior to being {@linkplain ConfigurableApplicationContext#refresh() refreshed}.
 *
 * <p>Typically used within web applications that require some programmatic initialization
 * of the application context. For example, registering property sources or activating
 * profiles against the {@linkplain ConfigurableApplicationContext#getEnvironment()
 * context's environment}. See {@code ContextLoader} and {@code FrameworkServlet} support
 * for declaring a "contextInitializerClasses" context-param and init-param, respectively.
 *
 * <p>{@code ApplicationContextInitializer} processors are encouraged to detect
 * whether Spring's {@link org.springframework.core.Ordered Ordered} interface has been
 * implemented or if the {@link org.springframework.core.annotation.Order @Order}
 * annotation is present and to sort instances accordingly if so prior to invocation.
 *
 * @author Chris Beams
 * @since 3.1
 * @param <C> the application context type
 * @see org.springframework.web.context.ContextLoader#customizeContext
 * @see org.springframework.web.context.ContextLoader#CONTEXT_INITIALIZER_CLASSES_PARAM
 * @see org.springframework.web.servlet.FrameworkServlet#setContextInitializerClasses
 * @see org.springframework.web.servlet.FrameworkServlet#applyInitializers
 */
/**
 *用于初始化Spring的回调接口｛@link ConfigurationApplicationContext｝
 *在被{@linkplain ConfigurationApplicationContext#refresh（）刷新}之前。
 *
 *<p>通常用于需要一些编程初始化的web应用程序中
 *应用程序上下文的。例如，注册属性源或激活
 *针对｛@linkplain ConfigurationApplicationContext#getEnvironment（）的配置文件
 *上下文的环境}。请参阅{@code ContextLoader}和{@code FrameworkServlet}支持
 *用于分别声明“contextInitializerClasses”上下文参数和init参数。
 *
 *<p>鼓励{@code ApplicationContextInitializer}处理器检测
 *Spring的｛@link org.springframework.core.Ordered Ordered｝接口是否已
 *已实现，或者如果｛@link org.springframework.core.annotation.Order@Order｝
 *注释是存在的，并在调用之前对实例进行相应的排序。
 *
 *@作者Chris Beams
 *@自3.1起
 *@param＜C＞应用程序上下文类型
 *请参阅org.springframework.web.context.ContextLoader#customizeContext
 *请参阅org.springframework.web.context.ContextLoader#context_INITIALIZER_CLASSE_PARAM
 *请参阅org.springframework.web.servlet.FrameworkServlet#setContextInitializerClasses
 *请参阅org.springframework.web.servlet.FrameworkServlet#applyInitializers
 */
@FunctionalInterface
public interface ApplicationContextInitializer<C extends ConfigurableApplicationContext> {

	/**
	 * Initialize the given application context.
	 * @param applicationContext the application to configure
	 */
	/**
	 *初始化给定的应用程序上下文。
	 *@param application要配置的应用程序上下文
	 */
	void initialize(C applicationContext);

}
